/*
 * Author : Priyanka & Lin
 * Inspiration : More Unit 
 */


package sg.edu.nus.iss.cerberus.ui;

import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.ui.JavaUI;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PartInitException;


public class EditorUI
{
    public IEditorPart open(IJavaElement element)
    {
        IEditorPart openedEditorPart = null;
        try
        {
            openedEditorPart = JavaUI.openInEditor(element);
        }
        catch (PartInitException exc)
        {
        	exc.printStackTrace();
          
        }
        catch (JavaModelException exc)
        {
        	exc.printStackTrace();
           
        }
        return openedEditorPart;
    }

    public void reveal(IEditorPart editorPart, IJavaElement element)
    {
        JavaUI.revealInEditor(editorPart, element);
    }
}
